package psrc.bd.dao;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

import psrc.bd.util.ConnectionFactory;

/**
 * Dao abstrato para servir de modelo para os outros
 * 
 * @author Felipe
 * 
 */
public abstract class AbstractDAO {

	protected Connection connection;

	public AbstractDAO(Connection conn) {
		if (conn != null){
			this.connection = conn;
		} else {
			this.connection = new ConnectionFactory().getConnection();
		}
	}

	public abstract <T> void adiciona(T _bean) throws SQLException;

	public abstract <T> void remove(T _bean) throws SQLException;

	public abstract <T> void edita(T _bean) throws SQLException;

	public abstract <T> List<T> seleciona() throws SQLException;
	
	public abstract <T> List<T> selecionaPorId(T _bean) throws SQLException;

}
